package com.fr.report.io.xml;

import com.fr.util.Utils;
import java.io.PrintWriter;
import java.util.Hashtable;

public class SynchronizedVersion
{
  private static Hashtable threadStyleHash = new Hashtable();
  private double version = 6.5D;
  private long xmlVersion = 0L;
  public static final String XMLVERSION_ATTR = "xmlVersion";
  public static final long CDATA_IN_WEBLOGIC_BUG_XML_Version = 20091127L;
  public static final long EM_CODE_XML_VERSION = 20091130L;
  public static final long IMAGE_CDATA_NO_NEWLINE_XML_VERSION = 20091224L;
  public static final long REPORT_REFECT_FOR65_XML_VERSION = 20100331L;
  public static final long REPORT_REFECT_FOR65_2_XML_VERSION = 20100901L;
  public static final long current_version = 20100901L;

  public static SynchronizedVersion getSynchronizedVersion(Thread paramThread)
  {
    SynchronizedVersion localSynchronizedVersion = (SynchronizedVersion)threadStyleHash.get(paramThread);
    if (localSynchronizedVersion == null)
    {
      localSynchronizedVersion = new SynchronizedVersion();
      threadStyleHash.put(paramThread, localSynchronizedVersion);
    }
    return localSynchronizedVersion;
  }

  public static boolean isAfterCPT_XML_Version()
  {
    return (getSynchronizedVersion(Thread.currentThread()).xmlVersion >= 20091127L);
  }

  public static boolean isAfterEM_CODE_XML_VERSION()
  {
    return (getSynchronizedVersion(Thread.currentThread()).xmlVersion >= 20091130L);
  }

  public static boolean isAfterIMAGE_CDATA_NO_NEWLINE_XML_VERSION()
  {
    return (getSynchronizedVersion(Thread.currentThread()).xmlVersion >= 20091224L);
  }

  public static boolean isAfterREPORT_REFECT_FOR65_XML_VERSION()
  {
    return (getSynchronizedVersion(Thread.currentThread()).xmlVersion >= 20100331L);
  }

  public static boolean isAfterREPORT_REFECT_FOR65_2_XML_VERSION()
  {
    return (getSynchronizedVersion(Thread.currentThread()).xmlVersion >= 20100901L);
  }

  public static void writeXMLVersion(PrintWriter paramPrintWriter)
  {
    paramPrintWriter.print("<XMLVersion>20100901</XMLVersion>");
  }

  public static SynchronizedVersion removeSynchronizedVersion(Thread paramThread)
  {
    return ((SynchronizedVersion)threadStyleHash.remove(paramThread));
  }

  public synchronized double getVersion()
  {
    return this.version;
  }

  public synchronized void setVersion(double paramDouble)
  {
    this.version = paramDouble;
  }

  public synchronized void setXmlVersionByString(String paramString)
  {
    if (paramString.startsWith("FR_XML_CDATA_WEBLOGIC_BUG"))
      setXmlVersion(20091127L);
    else
      setXmlVersion(Utils.objectToNumber(paramString, false).longValue());
  }

  public synchronized void setXmlVersion(long paramLong)
  {
    this.xmlVersion = paramLong;
  }
}